//
//  HYReservedDetailView.m
//  Booking
//
//  Created by Maybe_文仔 on 2018/10/2.
//  Copyright © 2018年 Duntech. All rights reserved.
//

#import "HYReservedDetailView.h"

@interface HYReservedDetailView()
@property (nonatomic, strong) UILabel *timeView;
@property (nonatomic, strong) UILabel *reserveInfoView;

@property (nonatomic, strong) UILabel *leftLineView;
@property (nonatomic, strong) UILabel *meetingNameLab;
@property (nonatomic, strong) UILabel *organizerLab;
@property (nonatomic, strong) UILabel *lineView;
@end

@implementation HYReservedDetailView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupSubview];
    }
    return self;
}

-(void)setupSubview{
    self.backgroundColor = KAPP_Clear_COLOR;
    
    [self addSubview:self.timeView];
    [self.reserveInfoView addSubview:self.leftLineView];
    [self.reserveInfoView addSubview:self.meetingNameLab];
    [self.reserveInfoView addSubview:self.organizerLab];
    [self.reserveInfoView addSubview:self.lineView];
    [self addSubview:self.reserveInfoView];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    [self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self);
        make.width.mas_equalTo(65);
    }];
    
    [self.reserveInfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.right.mas_equalTo(self);
        make.left.mas_equalTo(self.timeView.mas_right);
    }];
    
    [self.leftLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.mas_equalTo(self.reserveInfoView);
        make.width.mas_equalTo(5);
    }];
    
    [self.meetingNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.leftLineView.mas_right).mas_offset(25);
        make.top.mas_equalTo(self.reserveInfoView.mas_top).mas_offset(8);
    }];
    
    [self.organizerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.meetingNameLab.mas_centerY);
        make.left.mas_equalTo(self.meetingNameLab.mas_right).mas_offset(20);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(self.reserveInfoView);
        make.height.mas_equalTo(1);
    }];
}

-(void)setModel:(HYMyScheduleMeetingRoomModel *)model{
    self.meetingNameLab.text = model.markName;
    self.organizerLab.text = model.organizationman;
}

#pragma mark -- 懒加载
-(UILabel *)timeView{
    if (!_timeView) {
        _timeView = [UILabel new];
        _timeView.backgroundColor = KAPP_Clear_COLOR;
    }
    return _timeView;
}

-(UILabel *)reserveInfoView{
    if (!_reserveInfoView) {
        _reserveInfoView = [UILabel new];
        _reserveInfoView.backgroundColor = RGBColor(218, 242, 247);
    }
    return _reserveInfoView;
}

-(UILabel *)leftLineView{
    if (!_leftLineView) {
        _leftLineView = [UILabel new];
        _leftLineView.backgroundColor = RGBColor(52, 191, 206);
    }
    return _leftLineView;
}

-(UILabel *)meetingNameLab{
    if (!_meetingNameLab) {
        _meetingNameLab = [UILabel new];
        _meetingNameLab.textColor = RGBColor(34, 34, 34);
        _meetingNameLab.font = KFont(18);
    }
    return _meetingNameLab;
}

-(UILabel *)organizerLab{
    if (!_organizerLab) {
        _organizerLab = [UILabel new];
        _organizerLab.textColor = RGBColor(102, 102, 102);
        _organizerLab.font = KFont(14);
    }
    return _organizerLab;
}

-(UILabel *)lineView{
    if (!_lineView) {
        _lineView = [UILabel new];
        _lineView.backgroundColor = KAPP_WHITE_COLOR;
    }
    return _lineView;
}


//func setData(markName: String,organizer: String) -> Void {
//    meetingNameLab.text = markName
//    organizerLab.text = organizer
//}

@end
